package com.whut.www.file_storage;

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;

/**
 * Created by clvc on 2017/7/9.
 * 真正的速度是看不见的 !
 * Today is today , we will go !
 */

public class CustomCursorAdapter extends CursorAdapter {


    public CustomCursorAdapter(Context context, Cursor c) {
        super(context, c);
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {
        return LayoutInflater.from(context).inflate(R.layout.item_listview, null);
    }

    @Override
    public void bindView(View view, Context context, Cursor cursor) {
        TextView tv_word = (TextView) view.findViewById(R.id.tv_itemSummary);
        TextView tv_detail = (TextView) view.findViewById(R.id.tv_itemDetail);
        String word = cursor.getString(cursor.getColumnIndex("word"));
        String detail = cursor.getString(cursor.getColumnIndex("detail"));
        tv_word.setText(word);
        tv_detail.setText(detail);
    }
}
